{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "10781319-604c-46ff-a4a3-72f352759737",
   "metadata": {},
   "outputs": [],
   "source": [
    "import polars as pl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "2596ba42-eba1-4e7d-a292-2ce577bc132e",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pl.read_csv(\"stock_trades/202207-湘财.xls\",encoding=\"gb18030\",separator=\"\\t\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "9ded263d-2aeb-4702-bb9c-a6bf95894dff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "polars.dataframe.frame.DataFrame"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "6c19a453-df19-46d7-9fff-ea4781ed3f38",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(17, 16)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "1195918a-ef78-4d47-8078-f6dabff89d3e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.height"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "edbe110c-9f7a-459b-979c-94fb3ae3fc6d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.width"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "edaa7d09-54ea-4afe-bf45-ea5f155133b7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.is_empty()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "18e769a9-4c9a-4d6b-8055-23d6bb10dcb2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Schema([('发生日期', Int64),\n",
       "        ('证券代码', String),\n",
       "        ('证券名称', String),\n",
       "        ('买卖标志', String),\n",
       "        ('业务名称', String),\n",
       "        ('成交时间', String),\n",
       "        ('成交数量', String),\n",
       "        ('成交价格', Float64),\n",
       "        ('成交金额', Float64),\n",
       "        ('发生金额', Float64),\n",
       "        ('手续费', String),\n",
       "        ('印花税', String),\n",
       "        ('过户费', String),\n",
       "        ('其他费', String),\n",
       "        ('备注', String),\n",
       "        ('币种', String)])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.schema"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "f3d2e59a-a02d-4d11-a711-3a5bafc59c69",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['发生日期',\n",
       " '证券代码',\n",
       " '证券名称',\n",
       " '买卖标志',\n",
       " '业务名称',\n",
       " '成交时间',\n",
       " '成交数量',\n",
       " '成交价格',\n",
       " '成交金额',\n",
       " '发生金额',\n",
       " '手续费',\n",
       " '印花税',\n",
       " '过户费',\n",
       " '其他费',\n",
       " '备注',\n",
       " '币种']"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "8731d68c-a262-46f7-8e4b-c78a98258234",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[Int64,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " Float64,\n",
       " Float64,\n",
       " Float64,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String,\n",
       " String]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "519d64e2-cfca-48d8-b9f2-e6bf4f18bc37",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(df.schema.keys())==df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "0820c729-cf31-4f8b-bd61-64c67a104b9e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(df.schema.values())==df.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "1a894394-b5b7-4dd0-b9ec-69ffa7fe8fdc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (1, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220718</td><td>&quot;600408&quot;</td><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:52&quot;</td><td>&quot;47000.00&quot;</td><td>3.19</td><td>149930.0</td><td>-149955.5</td><td>&quot;23.99&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.51&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (1, 16)\n",
       "┌─────────┬─────────┬─────────┬────────┬───┬────────┬────────┬────────┬────────┐\n",
       "│ 发生日  ┆ 证券代  ┆ 证券名  ┆ 买卖标 ┆ … ┆ 过户费 ┆ 其他费 ┆ 备注   ┆ 币种   │\n",
       "│ 期      ┆ 码      ┆ 称      ┆ 志     ┆   ┆ ---    ┆ ---    ┆ ---    ┆ ---    │\n",
       "│ ---     ┆ ---     ┆ ---     ┆ ---    ┆   ┆ str    ┆ str    ┆ str    ┆ str    │\n",
       "│ i64     ┆ str     ┆ str     ┆ str    ┆   ┆        ┆        ┆        ┆        │\n",
       "╞═════════╪═════════╪═════════╪════════╪═══╪════════╪════════╪════════╪════════╡\n",
       "│ 2022071 ┆ 600408  ┆ 安泰集  ┆ 买入   ┆ … ┆ 1.51   ┆ =\"0.00 ┆ 证券买 ┆ 人民币 │\n",
       "│ 8       ┆         ┆ 团      ┆        ┆   ┆        ┆ \"      ┆ 入     ┆        │\n",
       "└─────────┴─────────┴─────────┴────────┴───┴────────┴────────┴────────┴────────┘"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "ac5b7a06-ce29-4fe1-9237-3b4e0036f9c0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (3, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220721</td><td>&quot;600269&quot;</td><td>&quot;赣粤高速&quot;</td><td>&quot;卖出&quot;</td><td>&quot;股息入账&quot;</td><td>&quot;16:00:00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>3.6</td><td>4884.0</td><td>4884.0</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;股息入账:赣粤高速600269; 权益股数:40700;&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:03:27&quot;</td><td>&quot;-580.00&quot;</td><td>1.675</td><td>58000.0</td><td>58018.63</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;融券购回:18.63实际占款天数：7-888880&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;=&quot;002462&quot;&quot;</td><td>&quot;嘉事堂&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;09:38:10&quot;</td><td>&quot;-10400.00&quot;</td><td>13.2062</td><td>137344.0</td><td>137184.67</td><td>&quot;21.98&quot;</td><td>&quot;137.35&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (3, 16)\n",
       "┌─────────┬─────────┬─────────┬────────┬───┬────────┬────────┬────────┬────────┐\n",
       "│ 发生日  ┆ 证券代  ┆ 证券名  ┆ 买卖标 ┆ … ┆ 过户费 ┆ 其他费 ┆ 备注   ┆ 币种   │\n",
       "│ 期      ┆ 码      ┆ 称      ┆ 志     ┆   ┆ ---    ┆ ---    ┆ ---    ┆ ---    │\n",
       "│ ---     ┆ ---     ┆ ---     ┆ ---    ┆   ┆ str    ┆ str    ┆ str    ┆ str    │\n",
       "│ i64     ┆ str     ┆ str     ┆ str    ┆   ┆        ┆        ┆        ┆        │\n",
       "╞═════════╪═════════╪═════════╪════════╪═══╪════════╪════════╪════════╪════════╡\n",
       "│ 2022072 ┆ 600269  ┆ 赣粤高  ┆ 卖出   ┆ … ┆ =\"0.00 ┆ =\"0.00 ┆ 股息入 ┆ 人民币 │\n",
       "│ 1       ┆         ┆ 速      ┆        ┆   ┆ \"      ┆ \"      ┆ 账:赣  ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 粤高速 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 600269 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ ; 权益 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 股数:4 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 0700;  ┆        │\n",
       "│ 2022071 ┆ 204007  ┆ GC007   ┆ 卖出   ┆ … ┆ =\"0.00 ┆ =\"0.00 ┆ 融券购 ┆ 人民币 │\n",
       "│ 8       ┆         ┆         ┆        ┆   ┆ \"      ┆ \"      ┆ 回:18. ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 63实际 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 占款天 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 数：7- ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 888880 ┆        │\n",
       "│ 2022071 ┆ =\"00246 ┆ 嘉事堂  ┆ 卖出   ┆ … ┆ 1.38   ┆ =\"0.00 ┆ 证券卖 ┆ 人民币 │\n",
       "│ 8       ┆ 2\"      ┆         ┆        ┆   ┆        ┆ \"      ┆ 出     ┆        │\n",
       "└─────────┴─────────┴─────────┴────────┴───┴────────┴────────┴────────┴────────┘"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "8383eaf8-f442-43a8-ae91-b7b29f0ee86a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (2, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>i64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>20220718</td><td>&quot;600408&quot;</td><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:52&quot;</td><td>&quot;47000.00&quot;</td><td>3.19</td><td>149930.0</td><td>-149955.5</td><td>&quot;23.99&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.51&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>20220718</td><td>&quot;600648&quot;</td><td>&quot;外高桥&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:31&quot;</td><td>&quot;11900.00&quot;</td><td>12.6066</td><td>150019.0</td><td>-150044.49</td><td>&quot;24.00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;1.49&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (2, 16)\n",
       "┌─────────┬─────────┬─────────┬────────┬───┬────────┬────────┬────────┬────────┐\n",
       "│ 发生日  ┆ 证券代  ┆ 证券名  ┆ 买卖标 ┆ … ┆ 过户费 ┆ 其他费 ┆ 备注   ┆ 币种   │\n",
       "│ 期      ┆ 码      ┆ 称      ┆ 志     ┆   ┆ ---    ┆ ---    ┆ ---    ┆ ---    │\n",
       "│ ---     ┆ ---     ┆ ---     ┆ ---    ┆   ┆ str    ┆ str    ┆ str    ┆ str    │\n",
       "│ i64     ┆ str     ┆ str     ┆ str    ┆   ┆        ┆        ┆        ┆        │\n",
       "╞═════════╪═════════╪═════════╪════════╪═══╪════════╪════════╪════════╪════════╡\n",
       "│ 2022071 ┆ 600408  ┆ 安泰集  ┆ 买入   ┆ … ┆ 1.51   ┆ =\"0.00 ┆ 证券买 ┆ 人民币 │\n",
       "│ 8       ┆         ┆ 团      ┆        ┆   ┆        ┆ \"      ┆ 入     ┆        │\n",
       "│ 2022071 ┆ 600648  ┆ 外高桥  ┆ 买入   ┆ … ┆ 1.49   ┆ =\"0.00 ┆ 证券买 ┆ 人民币 │\n",
       "│ 8       ┆         ┆         ┆        ┆   ┆        ┆ \"      ┆ 入     ┆        │\n",
       "└─────────┴─────────┴─────────┴────────┴───┴────────┴────────┴────────┴────────┘"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[3:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "43ab7312-dada-4d05-8749-02baba7c0a5f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (17,)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券名称</th></tr><tr><td>str</td></tr></thead><tbody><tr><td>&quot;赣粤高速&quot;</td></tr><tr><td>&quot;GC007&quot;</td></tr><tr><td>&quot;嘉事堂&quot;</td></tr><tr><td>&quot;安泰集团&quot;</td></tr><tr><td>&quot;外高桥&quot;</td></tr><tr><td>&hellip;</td></tr><tr><td>&quot;GC007&quot;</td></tr><tr><td>&quot;金隅集团&quot;</td></tr><tr><td>&quot;广日股份&quot;</td></tr><tr><td>&quot;渝农商行&quot;</td></tr><tr><td>&quot;GC007&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (17,)\n",
       "Series: '证券名称' [str]\n",
       "[\n",
       "\t\"赣粤高速\"\n",
       "\t\"GC007\"\n",
       "\t\"嘉事堂\"\n",
       "\t\"安泰集团\"\n",
       "\t\"外高桥\"\n",
       "\t…\n",
       "\t\"GC007\"\n",
       "\t\"金隅集团\"\n",
       "\t\"广日股份\"\n",
       "\t\"渝农商行\"\n",
       "\t\"GC007\"\n",
       "]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:,2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "bd3487f8-7a9d-4ae4-b090-0e56ee749485",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (17, 7)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th></tr><tr><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td></tr></thead><tbody><tr><td>&quot;赣粤高速&quot;</td><td>&quot;卖出&quot;</td><td>&quot;股息入账&quot;</td><td>&quot;16:00:00&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>3.6</td><td>4884.0</td></tr><tr><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:03:27&quot;</td><td>&quot;-580.00&quot;</td><td>1.675</td><td>58000.0</td></tr><tr><td>&quot;嘉事堂&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;09:38:10&quot;</td><td>&quot;-10400.00&quot;</td><td>13.2062</td><td>137344.0</td></tr><tr><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:52&quot;</td><td>&quot;47000.00&quot;</td><td>3.19</td><td>149930.0</td></tr><tr><td>&quot;外高桥&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:31&quot;</td><td>&quot;11900.00&quot;</td><td>12.6066</td><td>150019.0</td></tr><tr><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td><td>&hellip;</td></tr><tr><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;质押回购拆出&quot;</td><td>&quot;09:39:27&quot;</td><td>&quot;580.00&quot;</td><td>1.675</td><td>58000.0</td></tr><tr><td>&quot;金隅集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:37:25&quot;</td><td>&quot;54000.00&quot;</td><td>2.59</td><td>139860.0</td></tr><tr><td>&quot;广日股份&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:36:30&quot;</td><td>&quot;21400.00&quot;</td><td>6.54</td><td>139956.0</td></tr><tr><td>&quot;渝农商行&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:34:24&quot;</td><td>&quot;38300.00&quot;</td><td>3.65</td><td>139795.0</td></tr><tr><td>&quot;GC007&quot;</td><td>&quot;卖出&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;19:17:51&quot;</td><td>&quot;-7580.00&quot;</td><td>2.46</td><td>758000.0</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (17, 7)\n",
       "┌──────────┬──────────┬───────────┬──────────┬───────────┬──────────┬──────────┐\n",
       "│ 证券名称 ┆ 买卖标志 ┆ 业务名称  ┆ 成交时间 ┆ 成交数量  ┆ 成交价格 ┆ 成交金额 │\n",
       "│ ---      ┆ ---      ┆ ---       ┆ ---      ┆ ---       ┆ ---      ┆ ---      │\n",
       "│ str      ┆ str      ┆ str       ┆ str      ┆ str       ┆ f64      ┆ f64      │\n",
       "╞══════════╪══════════╪═══════════╪══════════╪═══════════╪══════════╪══════════╡\n",
       "│ 赣粤高速 ┆ 卖出     ┆ 股息入账  ┆ 16:00:00 ┆ =\"0.00\"   ┆ 3.6      ┆ 4884.0   │\n",
       "│ GC007    ┆ 卖出     ┆ 拆出质押  ┆ 19:03:27 ┆ -580.00   ┆ 1.675    ┆ 58000.0  │\n",
       "│          ┆          ┆ 购回      ┆          ┆           ┆          ┆          │\n",
       "│ 嘉事堂   ┆ 卖出     ┆ 证券卖出  ┆ 09:38:10 ┆ -10400.00 ┆ 13.2062  ┆ 137344.0 │\n",
       "│ 安泰集团 ┆ 买入     ┆ 证券买入  ┆ 09:44:52 ┆ 47000.00  ┆ 3.19     ┆ 149930.0 │\n",
       "│ 外高桥   ┆ 买入     ┆ 证券买入  ┆ 09:44:31 ┆ 11900.00  ┆ 12.6066  ┆ 150019.0 │\n",
       "│ …        ┆ …        ┆ …         ┆ …        ┆ …         ┆ …        ┆ …        │\n",
       "│ GC007    ┆ 卖出     ┆ 质押回购  ┆ 09:39:27 ┆ 580.00    ┆ 1.675    ┆ 58000.0  │\n",
       "│          ┆          ┆ 拆出      ┆          ┆           ┆          ┆          │\n",
       "│ 金隅集团 ┆ 买入     ┆ 证券买入  ┆ 09:37:25 ┆ 54000.00  ┆ 2.59     ┆ 139860.0 │\n",
       "│ 广日股份 ┆ 买入     ┆ 证券买入  ┆ 09:36:30 ┆ 21400.00  ┆ 6.54     ┆ 139956.0 │\n",
       "│ 渝农商行 ┆ 买入     ┆ 证券买入  ┆ 09:34:24 ┆ 38300.00  ┆ 3.65     ┆ 139795.0 │\n",
       "│ GC007    ┆ 卖出     ┆ 拆出质押  ┆ 19:17:51 ┆ -7580.00  ┆ 2.46     ┆ 758000.0 │\n",
       "│          ┆          ┆ 购回      ┆          ┆           ┆          ┆          │\n",
       "└──────────┴──────────┴───────────┴──────────┴───────────┴──────────┴──────────┘"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:,\"证券名称\":\"成交金额\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "4e772248-a933-4406-b6d6-02b75fd18aa2",
   "metadata": {},
   "outputs": [],
   "source": [
    "r=df.rows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "5331b2ce-37f3-44af-9e84-219adcf3a5a2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(r[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "d48109b9-d1c0-4831-964e-33bd1bdf569e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rows: 17\n",
      "Columns: 16\n",
      "$ 发生日期 <i64> 20220721, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718\n",
      "$ 证券代码 <str> '600269', '204007', '=\"002462\"', '600408', '600648', '600269', '600015', '601992', '600894', '601077'\n",
      "$ 证券名称 <str> '赣粤高速', 'GC007', '嘉事堂', '安泰集团', '外高桥', '赣粤高速', '华夏银行', '金隅集团', '广日股份', '渝农商行'\n",
      "$ 买卖标志 <str> '卖出', '卖出', '卖出', '买入', '买入', '买入', '买入', '卖出', '卖出', '卖出'\n",
      "$ 业务名称 <str> '股息入账', '拆出质押购回', '证券卖出', '证券买入', '证券买入', '证券买入', '证券买入', '证券卖出', '证券卖出', '证券卖出'\n",
      "$ 成交时间 <str> '16:00:00', '19:03:27', '09:38:10', '09:44:52', '09:44:31', '09:43:38', '09:42:51', '09:39:28', '09:39:06', '09:38:30'\n",
      "$ 成交数量 <str> '=\"0.00\"', '-580.00', '-10400.00', '47000.00', '11900.00', '40700.00', '30000.00', '-54000.00', '-21400.00', '-38300.00'\n",
      "$ 成交价格 <f64> 3.6, 1.675, 13.2062, 3.19, 12.6066, 3.69, 5.07, 2.5683, 6.5419, 3.58\n",
      "$ 成交金额 <f64> 4884.0, 58000.0, 137344.0, 149930.0, 150019.0, 150183.0, 152100.0, 138686.0, 139996.0, 137114.0\n",
      "$ 发生金额 <f64> 4884.0, 58018.63, 137184.67, -149955.5, -150044.49, -150208.53, -152125.86, 138523.74, 139832.12, 136953.55\n",
      "$ 手续费  <str> '=\"0.00\"', '=\"0.00\"', '21.98', '23.99', '24.00', '24.03', '24.34', '22.19', '22.40', '21.94'\n",
      "$ 印花税  <str> '=\"0.00\"', '=\"0.00\"', '137.35', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '138.69', '140.02', '137.13'\n",
      "$ 过户费  <str> '=\"0.00\"', '=\"0.00\"', '1.38', '1.51', '1.49', '1.50', '1.52', '1.38', '1.46', '1.38'\n",
      "$ 其他费  <str> '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"'\n",
      "$ 备注   <str> '股息入账:赣粤高速600269; 权益股数:40700;', '融券购回:18.63实际占款天数：7-888880', '证券卖出', '证券买入', '证券买入', '证券买入', '证券买入', '证券卖出', '证券卖出', '证券卖出'\n",
      "$ 币种   <str> '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币'\n",
      "\n"
     ]
    }
   ],
   "source": [
    "df.glimpse()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "ba32ab40-65ce-46db-8cf3-8f6e9ceb45aa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (5, 7)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th></tr><tr><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td></tr></thead><tbody><tr><td>&quot;广日股份&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;09:39:06&quot;</td><td>&quot;-21400.00&quot;</td><td>6.5419</td><td>139996.0</td></tr><tr><td>&quot;金隅集团&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;09:39:28&quot;</td><td>&quot;-54000.00&quot;</td><td>2.5683</td><td>138686.0</td></tr><tr><td>&quot;嘉事堂&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;09:38:10&quot;</td><td>&quot;-10400.00&quot;</td><td>13.2062</td><td>137344.0</td></tr><tr><td>&quot;金隅集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:37:25&quot;</td><td>&quot;54000.00&quot;</td><td>2.59</td><td>139860.0</td></tr><tr><td>&quot;安泰集团&quot;</td><td>&quot;买入&quot;</td><td>&quot;证券买入&quot;</td><td>&quot;09:44:52&quot;</td><td>&quot;47000.00&quot;</td><td>3.19</td><td>149930.0</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (5, 7)\n",
       "┌──────────┬──────────┬──────────┬──────────┬───────────┬──────────┬──────────┐\n",
       "│ 证券名称 ┆ 买卖标志 ┆ 业务名称 ┆ 成交时间 ┆ 成交数量  ┆ 成交价格 ┆ 成交金额 │\n",
       "│ ---      ┆ ---      ┆ ---      ┆ ---      ┆ ---       ┆ ---      ┆ ---      │\n",
       "│ str      ┆ str      ┆ str      ┆ str      ┆ str       ┆ f64      ┆ f64      │\n",
       "╞══════════╪══════════╪══════════╪══════════╪═══════════╪══════════╪══════════╡\n",
       "│ 广日股份 ┆ 卖出     ┆ 证券卖出 ┆ 09:39:06 ┆ -21400.00 ┆ 6.5419   ┆ 139996.0 │\n",
       "│ 金隅集团 ┆ 卖出     ┆ 证券卖出 ┆ 09:39:28 ┆ -54000.00 ┆ 2.5683   ┆ 138686.0 │\n",
       "│ 嘉事堂   ┆ 卖出     ┆ 证券卖出 ┆ 09:38:10 ┆ -10400.00 ┆ 13.2062  ┆ 137344.0 │\n",
       "│ 金隅集团 ┆ 买入     ┆ 证券买入 ┆ 09:37:25 ┆ 54000.00  ┆ 2.59     ┆ 139860.0 │\n",
       "│ 安泰集团 ┆ 买入     ┆ 证券买入 ┆ 09:44:52 ┆ 47000.00  ┆ 3.19     ┆ 149930.0 │\n",
       "└──────────┴──────────┴──────────┴──────────┴───────────┴──────────┴──────────┘"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[:,\"证券名称\":\"成交金额\"].sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "e2f24c07-164f-4fb6-a388-7cc416fbce55",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (9, 17)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>statistic</th><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>str</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>&quot;count&quot;</td><td>17.0</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>17.0</td><td>17.0</td><td>17.0</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td><td>&quot;17&quot;</td></tr><tr><td>&quot;null_count&quot;</td><td>0.0</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>0.0</td><td>0.0</td><td>0.0</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td><td>&quot;0&quot;</td></tr><tr><td>&quot;mean&quot;</td><td>2.0221e7</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>5.306059</td><td>160805.352941</td><td>815.642353</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;std&quot;</td><td>4.160387</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>3.974618</td><td>159439.770376</td><td>230047.143813</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;min&quot;</td><td>2.0220707e7</td><td>&quot;204007&quot;</td><td>&quot;GC007&quot;</td><td>&quot;买入&quot;</td><td>&quot;拆出质押购回&quot;</td><td>&quot;09:33:37&quot;</td><td>&quot;-10400.00&quot;</td><td>1.675</td><td>4884.0</td><td>-152125.86</td><td>&quot;2.90&quot;</td><td>&quot;137.13&quot;</td><td>&quot;1.38&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;股息入账:赣粤高速600269; 权益股数:40700;&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>&quot;25%&quot;</td><td>2.0220711e7</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>2.59</td><td>137344.0</td><td>-140526.48</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;50%&quot;</td><td>2.0220718e7</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>3.65</td><td>139860.0</td><td>-139342.29</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;75%&quot;</td><td>2.0220718e7</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>6.54</td><td>149930.0</td><td>136953.55</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td><td>null</td></tr><tr><td>&quot;max&quot;</td><td>2.0220721e7</td><td>&quot;=&quot;002462&quot;&quot;</td><td>&quot;金隅集团&quot;</td><td>&quot;卖出&quot;</td><td>&quot;质押回购拆出&quot;</td><td>&quot;19:17:51&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>13.51</td><td>758000.0</td><td>758357.61</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;=&quot;0.00&quot;&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (9, 17)\n",
       "┌─────────┬─────────┬─────────┬────────┬───┬────────┬────────┬────────┬────────┐\n",
       "│ statist ┆ 发生日  ┆ 证券代  ┆ 证券名 ┆ … ┆ 过户费 ┆ 其他费 ┆ 备注   ┆ 币种   │\n",
       "│ ic      ┆ 期      ┆ 码      ┆ 称     ┆   ┆ ---    ┆ ---    ┆ ---    ┆ ---    │\n",
       "│ ---     ┆ ---     ┆ ---     ┆ ---    ┆   ┆ str    ┆ str    ┆ str    ┆ str    │\n",
       "│ str     ┆ f64     ┆ str     ┆ str    ┆   ┆        ┆        ┆        ┆        │\n",
       "╞═════════╪═════════╪═════════╪════════╪═══╪════════╪════════╪════════╪════════╡\n",
       "│ count   ┆ 17.0    ┆ 17      ┆ 17     ┆ … ┆ 17     ┆ 17     ┆ 17     ┆ 17     │\n",
       "│ null_co ┆ 0.0     ┆ 0       ┆ 0      ┆ … ┆ 0      ┆ 0      ┆ 0      ┆ 0      │\n",
       "│ unt     ┆         ┆         ┆        ┆   ┆        ┆        ┆        ┆        │\n",
       "│ mean    ┆ 2.0221e ┆ null    ┆ null   ┆ … ┆ null   ┆ null   ┆ null   ┆ null   │\n",
       "│         ┆ 7       ┆         ┆        ┆   ┆        ┆        ┆        ┆        │\n",
       "│ std     ┆ 4.16038 ┆ null    ┆ null   ┆ … ┆ null   ┆ null   ┆ null   ┆ null   │\n",
       "│         ┆ 7       ┆         ┆        ┆   ┆        ┆        ┆        ┆        │\n",
       "│ min     ┆ 2.02207 ┆ 204007  ┆ GC007  ┆ … ┆ 1.38   ┆ =\"0.00 ┆ 股息入 ┆ 人民币 │\n",
       "│         ┆ 07e7    ┆         ┆        ┆   ┆        ┆ \"      ┆ 账:赣  ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 粤高速 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 600269 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ ; 权益 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 股数:4 ┆        │\n",
       "│         ┆         ┆         ┆        ┆   ┆        ┆        ┆ 0700;  ┆        │\n",
       "│ 25%     ┆ 2.02207 ┆ null    ┆ null   ┆ … ┆ null   ┆ null   ┆ null   ┆ null   │\n",
       "│         ┆ 11e7    ┆         ┆        ┆   ┆        ┆        ┆        ┆        │\n",
       "│ 50%     ┆ 2.02207 ┆ null    ┆ null   ┆ … ┆ null   ┆ null   ┆ null   ┆ null   │\n",
       "│         ┆ 18e7    ┆         ┆        ┆   ┆        ┆        ┆        ┆        │\n",
       "│ 75%     ┆ 2.02207 ┆ null    ┆ null   ┆ … ┆ null   ┆ null   ┆ null   ┆ null   │\n",
       "│         ┆ 18e7    ┆         ┆        ┆   ┆        ┆        ┆        ┆        │\n",
       "│ max     ┆ 2.02207 ┆ =\"00246 ┆ 金隅集 ┆ … ┆ =\"0.00 ┆ =\"0.00 ┆ 证券卖 ┆ 人民币 │\n",
       "│         ┆ 21e7    ┆ 2\"      ┆ 团     ┆   ┆ \"      ┆ \"      ┆ 出     ┆        │\n",
       "└─────────┴─────────┴─────────┴────────┴───┴────────┴────────┴────────┴────────┘"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "f221b014-cb0f-4104-bd57-6e522e28756e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>发生日期</th>\n",
       "      <th>证券代码</th>\n",
       "      <th>证券名称</th>\n",
       "      <th>买卖标志</th>\n",
       "      <th>业务名称</th>\n",
       "      <th>成交时间</th>\n",
       "      <th>成交数量</th>\n",
       "      <th>成交价格</th>\n",
       "      <th>成交金额</th>\n",
       "      <th>发生金额</th>\n",
       "      <th>手续费</th>\n",
       "      <th>印花税</th>\n",
       "      <th>过户费</th>\n",
       "      <th>其他费</th>\n",
       "      <th>备注</th>\n",
       "      <th>币种</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>20220721</td>\n",
       "      <td>600269</td>\n",
       "      <td>赣粤高速</td>\n",
       "      <td>卖出</td>\n",
       "      <td>股息入账</td>\n",
       "      <td>16:00:00</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>3.6000</td>\n",
       "      <td>4884.0</td>\n",
       "      <td>4884.00</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>股息入账:赣粤高速600269; 权益股数:40700;</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>20220718</td>\n",
       "      <td>204007</td>\n",
       "      <td>GC007</td>\n",
       "      <td>卖出</td>\n",
       "      <td>拆出质押购回</td>\n",
       "      <td>19:03:27</td>\n",
       "      <td>-580.00</td>\n",
       "      <td>1.6750</td>\n",
       "      <td>58000.0</td>\n",
       "      <td>58018.63</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>融券购回:18.63实际占款天数：7-888880</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>20220718</td>\n",
       "      <td>=\"002462\"</td>\n",
       "      <td>嘉事堂</td>\n",
       "      <td>卖出</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>09:38:10</td>\n",
       "      <td>-10400.00</td>\n",
       "      <td>13.2062</td>\n",
       "      <td>137344.0</td>\n",
       "      <td>137184.67</td>\n",
       "      <td>21.98</td>\n",
       "      <td>137.35</td>\n",
       "      <td>1.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600408</td>\n",
       "      <td>安泰集团</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:44:52</td>\n",
       "      <td>47000.00</td>\n",
       "      <td>3.1900</td>\n",
       "      <td>149930.0</td>\n",
       "      <td>-149955.50</td>\n",
       "      <td>23.99</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.51</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600648</td>\n",
       "      <td>外高桥</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:44:31</td>\n",
       "      <td>11900.00</td>\n",
       "      <td>12.6066</td>\n",
       "      <td>150019.0</td>\n",
       "      <td>-150044.49</td>\n",
       "      <td>24.00</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.49</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600269</td>\n",
       "      <td>赣粤高速</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:43:38</td>\n",
       "      <td>40700.00</td>\n",
       "      <td>3.6900</td>\n",
       "      <td>150183.0</td>\n",
       "      <td>-150208.53</td>\n",
       "      <td>24.03</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.50</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600015</td>\n",
       "      <td>华夏银行</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:42:51</td>\n",
       "      <td>30000.00</td>\n",
       "      <td>5.0700</td>\n",
       "      <td>152100.0</td>\n",
       "      <td>-152125.86</td>\n",
       "      <td>24.34</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.52</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>20220718</td>\n",
       "      <td>601992</td>\n",
       "      <td>金隅集团</td>\n",
       "      <td>卖出</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>09:39:28</td>\n",
       "      <td>-54000.00</td>\n",
       "      <td>2.5683</td>\n",
       "      <td>138686.0</td>\n",
       "      <td>138523.74</td>\n",
       "      <td>22.19</td>\n",
       "      <td>138.69</td>\n",
       "      <td>1.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>20220718</td>\n",
       "      <td>600894</td>\n",
       "      <td>广日股份</td>\n",
       "      <td>卖出</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>09:39:06</td>\n",
       "      <td>-21400.00</td>\n",
       "      <td>6.5419</td>\n",
       "      <td>139996.0</td>\n",
       "      <td>139832.12</td>\n",
       "      <td>22.40</td>\n",
       "      <td>140.02</td>\n",
       "      <td>1.46</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>20220718</td>\n",
       "      <td>601077</td>\n",
       "      <td>渝农商行</td>\n",
       "      <td>卖出</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>09:38:30</td>\n",
       "      <td>-38300.00</td>\n",
       "      <td>3.5800</td>\n",
       "      <td>137114.0</td>\n",
       "      <td>136953.55</td>\n",
       "      <td>21.94</td>\n",
       "      <td>137.13</td>\n",
       "      <td>1.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券卖出</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>20220711</td>\n",
       "      <td>=\"002462\"</td>\n",
       "      <td>嘉事堂</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:38:16</td>\n",
       "      <td>10400.00</td>\n",
       "      <td>13.5100</td>\n",
       "      <td>140504.0</td>\n",
       "      <td>-140526.48</td>\n",
       "      <td>22.48</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.41</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>20220711</td>\n",
       "      <td>=\"000900\"</td>\n",
       "      <td>现代投资</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:33:37</td>\n",
       "      <td>34400.00</td>\n",
       "      <td>4.0500</td>\n",
       "      <td>139320.0</td>\n",
       "      <td>-139342.29</td>\n",
       "      <td>22.29</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.39</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>20220711</td>\n",
       "      <td>204007</td>\n",
       "      <td>GC007</td>\n",
       "      <td>卖出</td>\n",
       "      <td>质押回购拆出</td>\n",
       "      <td>09:39:27</td>\n",
       "      <td>580.00</td>\n",
       "      <td>1.6750</td>\n",
       "      <td>58000.0</td>\n",
       "      <td>-58002.90</td>\n",
       "      <td>2.90</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>融券回购购回日:20220718预计利息:18.63参考占款天数：7-888880</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>20220711</td>\n",
       "      <td>601992</td>\n",
       "      <td>金隅集团</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:37:25</td>\n",
       "      <td>54000.00</td>\n",
       "      <td>2.5900</td>\n",
       "      <td>139860.0</td>\n",
       "      <td>-139883.80</td>\n",
       "      <td>22.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.42</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>20220711</td>\n",
       "      <td>600894</td>\n",
       "      <td>广日股份</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:36:30</td>\n",
       "      <td>21400.00</td>\n",
       "      <td>6.5400</td>\n",
       "      <td>139956.0</td>\n",
       "      <td>-139979.80</td>\n",
       "      <td>22.39</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.41</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>20220711</td>\n",
       "      <td>601077</td>\n",
       "      <td>渝农商行</td>\n",
       "      <td>买入</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>09:34:24</td>\n",
       "      <td>38300.00</td>\n",
       "      <td>3.6500</td>\n",
       "      <td>139795.0</td>\n",
       "      <td>-139818.75</td>\n",
       "      <td>22.37</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>1.38</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>证券买入</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>20220707</td>\n",
       "      <td>204007</td>\n",
       "      <td>GC007</td>\n",
       "      <td>卖出</td>\n",
       "      <td>拆出质押购回</td>\n",
       "      <td>19:17:51</td>\n",
       "      <td>-7580.00</td>\n",
       "      <td>2.4600</td>\n",
       "      <td>758000.0</td>\n",
       "      <td>758357.61</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>=\"0.00\"</td>\n",
       "      <td>融券购回:357.61实际占款天数：7-888880</td>\n",
       "      <td>人民币</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        发生日期       证券代码   证券名称 买卖标志    业务名称      成交时间       成交数量     成交价格  \\\n",
       "0   20220721     600269   赣粤高速   卖出    股息入账  16:00:00    =\"0.00\"   3.6000   \n",
       "1   20220718     204007  GC007   卖出  拆出质押购回  19:03:27    -580.00   1.6750   \n",
       "2   20220718  =\"002462\"    嘉事堂   卖出    证券卖出  09:38:10  -10400.00  13.2062   \n",
       "3   20220718     600408   安泰集团   买入    证券买入  09:44:52   47000.00   3.1900   \n",
       "4   20220718     600648    外高桥   买入    证券买入  09:44:31   11900.00  12.6066   \n",
       "5   20220718     600269   赣粤高速   买入    证券买入  09:43:38   40700.00   3.6900   \n",
       "6   20220718     600015   华夏银行   买入    证券买入  09:42:51   30000.00   5.0700   \n",
       "7   20220718     601992   金隅集团   卖出    证券卖出  09:39:28  -54000.00   2.5683   \n",
       "8   20220718     600894   广日股份   卖出    证券卖出  09:39:06  -21400.00   6.5419   \n",
       "9   20220718     601077   渝农商行   卖出    证券卖出  09:38:30  -38300.00   3.5800   \n",
       "10  20220711  =\"002462\"    嘉事堂   买入    证券买入  09:38:16   10400.00  13.5100   \n",
       "11  20220711  =\"000900\"   现代投资   买入    证券买入  09:33:37   34400.00   4.0500   \n",
       "12  20220711     204007  GC007   卖出  质押回购拆出  09:39:27     580.00   1.6750   \n",
       "13  20220711     601992   金隅集团   买入    证券买入  09:37:25   54000.00   2.5900   \n",
       "14  20220711     600894   广日股份   买入    证券买入  09:36:30   21400.00   6.5400   \n",
       "15  20220711     601077   渝农商行   买入    证券买入  09:34:24   38300.00   3.6500   \n",
       "16  20220707     204007  GC007   卖出  拆出质押购回  19:17:51   -7580.00   2.4600   \n",
       "\n",
       "        成交金额       发生金额      手续费      印花税      过户费      其他费  \\\n",
       "0     4884.0    4884.00  =\"0.00\"  =\"0.00\"  =\"0.00\"  =\"0.00\"   \n",
       "1    58000.0   58018.63  =\"0.00\"  =\"0.00\"  =\"0.00\"  =\"0.00\"   \n",
       "2   137344.0  137184.67    21.98   137.35     1.38  =\"0.00\"   \n",
       "3   149930.0 -149955.50    23.99  =\"0.00\"     1.51  =\"0.00\"   \n",
       "4   150019.0 -150044.49    24.00  =\"0.00\"     1.49  =\"0.00\"   \n",
       "5   150183.0 -150208.53    24.03  =\"0.00\"     1.50  =\"0.00\"   \n",
       "6   152100.0 -152125.86    24.34  =\"0.00\"     1.52  =\"0.00\"   \n",
       "7   138686.0  138523.74    22.19   138.69     1.38  =\"0.00\"   \n",
       "8   139996.0  139832.12    22.40   140.02     1.46  =\"0.00\"   \n",
       "9   137114.0  136953.55    21.94   137.13     1.38  =\"0.00\"   \n",
       "10  140504.0 -140526.48    22.48  =\"0.00\"     1.41  =\"0.00\"   \n",
       "11  139320.0 -139342.29    22.29  =\"0.00\"     1.39  =\"0.00\"   \n",
       "12   58000.0  -58002.90     2.90  =\"0.00\"  =\"0.00\"  =\"0.00\"   \n",
       "13  139860.0 -139883.80    22.38  =\"0.00\"     1.42  =\"0.00\"   \n",
       "14  139956.0 -139979.80    22.39  =\"0.00\"     1.41  =\"0.00\"   \n",
       "15  139795.0 -139818.75    22.37  =\"0.00\"     1.38  =\"0.00\"   \n",
       "16  758000.0  758357.61  =\"0.00\"  =\"0.00\"  =\"0.00\"  =\"0.00\"   \n",
       "\n",
       "                                           备注   币种  \n",
       "0                股息入账:赣粤高速600269; 权益股数:40700;  人民币  \n",
       "1                   融券购回:18.63实际占款天数：7-888880  人民币  \n",
       "2                                        证券卖出  人民币  \n",
       "3                                        证券买入  人民币  \n",
       "4                                        证券买入  人民币  \n",
       "5                                        证券买入  人民币  \n",
       "6                                        证券买入  人民币  \n",
       "7                                        证券卖出  人民币  \n",
       "8                                        证券卖出  人民币  \n",
       "9                                        证券卖出  人民币  \n",
       "10                                       证券买入  人民币  \n",
       "11                                       证券买入  人民币  \n",
       "12  融券回购购回日:20220718预计利息:18.63参考占款天数：7-888880  人民币  \n",
       "13                                       证券买入  人民币  \n",
       "14                                       证券买入  人民币  \n",
       "15                                       证券买入  人民币  \n",
       "16                 融券购回:357.61实际占款天数：7-888880  人民币  "
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_pandas()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "58863e38-47a2-492a-9e6d-1bc3f70f823a",
   "metadata": {},
   "outputs": [],
   "source": [
    "s=df.to_series()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "5ca74dcd-eeb0-4d99-8e9f-524c659d9017",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'发生日期'"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "b95813e8-d6be-4885-ae10-fe2520d8e23c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Int64"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "14ce80b6-c216-4c7a-a419-70d4c927210f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(17,)"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "32ff1b5d-ec01-4f3b-b5ba-9fb544137e77",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.len()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "4f18aa15-9ab1-4bbe-840a-d4bfa3b3aa6d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (5, 2)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>业务名称</th><th>count</th></tr><tr><td>str</td><td>u32</td></tr></thead><tbody><tr><td>&quot;证券卖出&quot;</td><td>4</td></tr><tr><td>&quot;股息入账&quot;</td><td>1</td></tr><tr><td>&quot;拆出质押购回&quot;</td><td>2</td></tr><tr><td>&quot;证券买入&quot;</td><td>9</td></tr><tr><td>&quot;质押回购拆出&quot;</td><td>1</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (5, 2)\n",
       "┌──────────────┬───────┐\n",
       "│ 业务名称     ┆ count │\n",
       "│ ---          ┆ ---   │\n",
       "│ str          ┆ u32   │\n",
       "╞══════════════╪═══════╡\n",
       "│ 证券卖出     ┆ 4     │\n",
       "│ 股息入账     ┆ 1     │\n",
       "│ 拆出质押购回 ┆ 2     │\n",
       "│ 证券买入     ┆ 9     │\n",
       "│ 质押回购拆出 ┆ 1     │\n",
       "└──────────────┴───────┘"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.to_series(4).value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "17da1b93-05e8-4a4f-a6c3-95daa48da641",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rows: 17\n",
      "Columns: 16\n",
      "$ 发生日期 <i64> 20220721, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718, 20220718\n",
      "$ 证券代码 <str> '600269', '204007', '=\"002462\"', '600408', '600648', '600269', '600015', '601992', '600894', '601077'\n",
      "$ 证券名称 <str> '赣粤高速', 'GC007', '嘉事堂', '安泰集团', '外高桥', '赣粤高速', '华夏银行', '金隅集团', '广日股份', '渝农商行'\n",
      "$ 买卖标志 <str> '卖出', '卖出', '卖出', '买入', '买入', '买入', '买入', '卖出', '卖出', '卖出'\n",
      "$ 业务名称 <str> '股息入账', '拆出质押购回', '证券卖出', '证券买入', '证券买入', '证券买入', '证券买入', '证券卖出', '证券卖出', '证券卖出'\n",
      "$ 成交时间 <str> '16:00:00', '19:03:27', '09:38:10', '09:44:52', '09:44:31', '09:43:38', '09:42:51', '09:39:28', '09:39:06', '09:38:30'\n",
      "$ 成交数量 <str> '=\"0.00\"', '-580.00', '-10400.00', '47000.00', '11900.00', '40700.00', '30000.00', '-54000.00', '-21400.00', '-38300.00'\n",
      "$ 成交价格 <f64> 3.6, 1.675, 13.2062, 3.19, 12.6066, 3.69, 5.07, 2.5683, 6.5419, 3.58\n",
      "$ 成交金额 <f64> 4884.0, 58000.0, 137344.0, 149930.0, 150019.0, 150183.0, 152100.0, 138686.0, 139996.0, 137114.0\n",
      "$ 发生金额 <f64> 4884.0, 58018.63, 137184.67, -149955.5, -150044.49, -150208.53, -152125.86, 138523.74, 139832.12, 136953.55\n",
      "$ 手续费  <str> '=\"0.00\"', '=\"0.00\"', '21.98', '23.99', '24.00', '24.03', '24.34', '22.19', '22.40', '21.94'\n",
      "$ 印花税  <str> '=\"0.00\"', '=\"0.00\"', '137.35', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '138.69', '140.02', '137.13'\n",
      "$ 过户费  <str> '=\"0.00\"', '=\"0.00\"', '1.38', '1.51', '1.49', '1.50', '1.52', '1.38', '1.46', '1.38'\n",
      "$ 其他费  <str> '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"', '=\"0.00\"'\n",
      "$ 备注   <str> '股息入账:赣粤高速600269; 权益股数:40700;', '融券购回:18.63实际占款天数：7-888880', '证券卖出', '证券买入', '证券买入', '证券买入', '证券买入', '证券卖出', '证券卖出', '证券卖出'\n",
      "$ 币种   <str> '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币', '人民币'\n",
      "\n"
     ]
    }
   ],
   "source": [
    "df.glimpse()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "9fc4637c-9b2a-475b-b57f-56ec3f262462",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pl.read_csv(\"stock_trades/202207-湘财.xls\",encoding=\"gb18030\",separator=\"\\t\",infer_schema=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "e2f7c4d7-1a87-4a7b-92fd-a0a5fd880fd1",
   "metadata": {},
   "outputs": [],
   "source": [
    "def read_df_湘财(f:str | Path) -> pl.DataFrame:\n",
    "    \n",
    "    df=pl.read_csv(f,encoding=\"gb18030\",separator=\"\\t\",infer_schema=False)\n",
    "    df=df.with_columns(\n",
    "        pl.selectors.all().str.strip_prefix(\"=\").str.strip_chars('\"'),\n",
    "    ).with_columns(\n",
    "        \n",
    "        pl.col(\"发生日期\").str.to_date(\"%Y%m%d\"),\n",
    "        \n",
    "        pl.col(\"成交时间\").str.to_time(),\n",
    "        pl.col(\"成交数量\",\"成交价格\",\"成交金额\",\"发生金额\",\"手续费\",\"印花税\").cast(pl.Float64),\n",
    "    )\n",
    "    df=df.filter(\n",
    "        pl.col(\"业务名称\").is_in([\"证券买入\",\"证券卖出\"]),\n",
    "    )\n",
    "    return df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "bb48f86c-83e4-4bae-88ba-c5db2b658ed5",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true,
     "source_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (3, 2)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>foo</th><th>foo2</th></tr><tr><td>str</td><td>str</td></tr></thead><tbody><tr><td>&quot;asldjl&quot;</td><td>&quot;sldj&quot;</td></tr><tr><td>&quot;jjjask&quot;</td><td>&quot;jjjask&quot;</td></tr><tr><td>&quot;hasna&quot;</td><td>&quot;hasn&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (3, 2)\n",
       "┌────────┬────────┐\n",
       "│ foo    ┆ foo2   │\n",
       "│ ---    ┆ ---    │\n",
       "│ str    ┆ str    │\n",
       "╞════════╪════════╡\n",
       "│ asldjl ┆ sldj   │\n",
       "│ jjjask ┆ jjjask │\n",
       "│ hasna  ┆ hasn   │\n",
       "└────────┴────────┘"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=pl.DataFrame(\n",
    "    {\n",
    "        \"foo\":[\"asldjl\",\"jjjask\",\"hasna\"],\n",
    "    }\n",
    ")\n",
    "df.with_columns(foo2=pl.col(\"foo\").str.strip_chars(\"al\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "id": "819aa89f-521e-46bc-8288-f4f4598d027d",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pathlib import Path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "4ab2507e-9b2b-471c-8a3f-5ef9bd9033a6",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = [read_df_湘财(f)for f in Path(\"stock_trades/\").glob(\"*-湘财.xls\")]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "74bf6c81-ebaa-4022-990a-5e82a3aec30d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "13"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "5b854445-d3ee-4975-8a16-6c32219fd469",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (4, 16)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>发生日期</th><th>证券代码</th><th>证券名称</th><th>买卖标志</th><th>业务名称</th><th>成交时间</th><th>成交数量</th><th>成交价格</th><th>成交金额</th><th>发生金额</th><th>手续费</th><th>印花税</th><th>过户费</th><th>其他费</th><th>备注</th><th>币种</th></tr><tr><td>date</td><td>str</td><td>str</td><td>str</td><td>str</td><td>time</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>f64</td><td>str</td><td>str</td><td>str</td><td>str</td></tr></thead><tbody><tr><td>2023-06-19</td><td>&quot;603967&quot;</td><td>&quot;中创物流&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>10:18:46</td><td>-5000.0</td><td>9.13</td><td>45650.0</td><td>45596.59</td><td>7.3</td><td>45.65</td><td>&quot;0.46&quot;</td><td>&quot;0.00&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2023-06-12</td><td>&quot;300641&quot;</td><td>&quot;正丹股份&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>13:22:32</td><td>-9600.0</td><td>5.05</td><td>48480.0</td><td>48423.76</td><td>7.76</td><td>48.48</td><td>&quot;0.48&quot;</td><td>&quot;0.00&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2023-06-02</td><td>&quot;000655&quot;</td><td>&quot;金岭矿业&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>10:26:35</td><td>-7500.0</td><td>6.48</td><td>48600.0</td><td>48543.61</td><td>7.78</td><td>48.61</td><td>&quot;0.47&quot;</td><td>&quot;0.00&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr><tr><td>2023-06-01</td><td>&quot;300214&quot;</td><td>&quot;日科化学&quot;</td><td>&quot;卖出&quot;</td><td>&quot;证券卖出&quot;</td><td>10:45:35</td><td>-7400.0</td><td>6.8</td><td>50320.0</td><td>50261.63</td><td>8.05</td><td>50.32</td><td>&quot;0.51&quot;</td><td>&quot;0.00&quot;</td><td>&quot;证券卖出&quot;</td><td>&quot;人民币&quot;</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (4, 16)\n",
       "┌─────────┬─────────┬─────────┬────────┬───┬────────┬────────┬────────┬────────┐\n",
       "│ 发生日  ┆ 证券代  ┆ 证券名  ┆ 买卖标 ┆ … ┆ 过户费 ┆ 其他费 ┆ 备注   ┆ 币种   │\n",
       "│ 期      ┆ 码      ┆ 称      ┆ 志     ┆   ┆ ---    ┆ ---    ┆ ---    ┆ ---    │\n",
       "│ ---     ┆ ---     ┆ ---     ┆ ---    ┆   ┆ str    ┆ str    ┆ str    ┆ str    │\n",
       "│ date    ┆ str     ┆ str     ┆ str    ┆   ┆        ┆        ┆        ┆        │\n",
       "╞═════════╪═════════╪═════════╪════════╪═══╪════════╪════════╪════════╪════════╡\n",
       "│ 2023-06 ┆ 603967  ┆ 中创物  ┆ 卖出   ┆ … ┆ 0.46   ┆ 0.00   ┆ 证券卖 ┆ 人民币 │\n",
       "│ -19     ┆         ┆ 流      ┆        ┆   ┆        ┆        ┆ 出     ┆        │\n",
       "│ 2023-06 ┆ 300641  ┆ 正丹股  ┆ 卖出   ┆ … ┆ 0.48   ┆ 0.00   ┆ 证券卖 ┆ 人民币 │\n",
       "│ -12     ┆         ┆ 份      ┆        ┆   ┆        ┆        ┆ 出     ┆        │\n",
       "│ 2023-06 ┆ 000655  ┆ 金岭矿  ┆ 卖出   ┆ … ┆ 0.47   ┆ 0.00   ┆ 证券卖 ┆ 人民币 │\n",
       "│ -02     ┆         ┆ 业      ┆        ┆   ┆        ┆        ┆ 出     ┆        │\n",
       "│ 2023-06 ┆ 300214  ┆ 日科化  ┆ 卖出   ┆ … ┆ 0.51   ┆ 0.00   ┆ 证券卖 ┆ 人民币 │\n",
       "│ -01     ┆         ┆ 学      ┆        ┆   ┆        ┆        ┆ 出     ┆        │\n",
       "└─────────┴─────────┴─────────┴────────┴───┴────────┴────────┴────────┴────────┘"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[-2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "id": "a25ce656-335a-4e08-987c-1b777378d2e5",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1=pl.concat(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "id": "ed1f7842-89af-4d60-ada8-602d5619aecb",
   "metadata": {},
   "outputs": [],
   "source": [
    "d1=d1.with_columns(\n",
    "    券商=pl.lit(\"湘财\"),\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "id": "aa7f6dad-68d8-473a-ba36-ae429930d2ee",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "required package 'fastexcel' not found.\nPlease install using the command `pip install fastexcel`.",
     "output_type": "error",
     "traceback": [
      "\u001b[31m---------------------------------------------------------------------------\u001b[39m",
      "\u001b[31mModuleNotFoundError\u001b[39m                       Traceback (most recent call last)",
      "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[93]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m df = \u001b[43mpl\u001b[49m\u001b[43m.\u001b[49m\u001b[43mread_excel\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstock_trades/202305-海通普通.xlsx\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
      "\u001b[36mFile \u001b[39m\u001b[32mD:\\anana\\damangshe\\envs\\week07\\Lib\\site-packages\\polars\\_utils\\deprecation.py:119\u001b[39m, in \u001b[36mdeprecate_renamed_parameter.<locals>.decorate.<locals>.wrapper\u001b[39m\u001b[34m(*args, **kwargs)\u001b[39m\n\u001b[32m    114\u001b[39m \u001b[38;5;129m@wraps\u001b[39m(function)\n\u001b[32m    115\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mwrapper\u001b[39m(*args: P.args, **kwargs: P.kwargs) -> T:\n\u001b[32m    116\u001b[39m     _rename_keyword_argument(\n\u001b[32m    117\u001b[39m         old_name, new_name, kwargs, function.\u001b[34m__qualname__\u001b[39m, version\n\u001b[32m    118\u001b[39m     )\n\u001b[32m--> \u001b[39m\u001b[32m119\u001b[39m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunction\u001b[49m\u001b[43m(\u001b[49m\u001b[43m*\u001b[49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
      "\u001b[36mFile \u001b[39m\u001b[32mD:\\anana\\damangshe\\envs\\week07\\Lib\\site-packages\\polars\\_utils\\deprecation.py:119\u001b[39m, in \u001b[36mdeprecate_renamed_parameter.<locals>.decorate.<locals>.wrapper\u001b[39m\u001b[34m(*args, **kwargs)\u001b[39m\n\u001b[32m    114\u001b[39m \u001b[38;5;129m@wraps\u001b[39m(function)\n\u001b[32m    115\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mwrapper\u001b[39m(*args: P.args, **kwargs: P.kwargs) -> T:\n\u001b[32m    116\u001b[39m     _rename_keyword_argument(\n\u001b[32m    117\u001b[39m         old_name, new_name, kwargs, function.\u001b[34m__qualname__\u001b[39m, version\n\u001b[32m    118\u001b[39m     )\n\u001b[32m--> \u001b[39m\u001b[32m119\u001b[39m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunction\u001b[49m\u001b[43m(\u001b[49m\u001b[43m*\u001b[49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
      "\u001b[36mFile \u001b[39m\u001b[32mD:\\anana\\damangshe\\envs\\week07\\Lib\\site-packages\\polars\\io\\spreadsheet\\functions.py:399\u001b[39m, in \u001b[36mread_excel\u001b[39m\u001b[34m(source, sheet_id, sheet_name, table_name, engine, engine_options, read_options, has_header, columns, schema_overrides, infer_schema_length, include_file_paths, drop_empty_rows, drop_empty_cols, raise_if_empty)\u001b[39m\n\u001b[32m    259\u001b[39m \u001b[38;5;250m\u001b[39m\u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m    260\u001b[39m \u001b[33;03mRead Excel spreadsheet data into a DataFrame.\u001b[39;00m\n\u001b[32m    261\u001b[39m \n\u001b[32m   (...)\u001b[39m\u001b[32m    395\u001b[39m \u001b[33;03m... )  # doctest: +SKIP\u001b[39;00m\n\u001b[32m    396\u001b[39m \u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m    397\u001b[39m sources, read_multiple_workbooks = _sources(source)\n\u001b[32m    398\u001b[39m frames: \u001b[38;5;28mlist\u001b[39m[pl.DataFrame] | \u001b[38;5;28mlist\u001b[39m[\u001b[38;5;28mdict\u001b[39m[\u001b[38;5;28mstr\u001b[39m, pl.DataFrame]] = [  \u001b[38;5;66;03m# type: ignore[assignment]\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m399\u001b[39m     \u001b[43m_read_spreadsheet\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m    400\u001b[39m \u001b[43m        \u001b[49m\u001b[43msrc\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    401\u001b[39m \u001b[43m        \u001b[49m\u001b[43msheet_id\u001b[49m\u001b[43m=\u001b[49m\u001b[43msheet_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    402\u001b[39m \u001b[43m        \u001b[49m\u001b[43msheet_name\u001b[49m\u001b[43m=\u001b[49m\u001b[43msheet_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    403\u001b[39m \u001b[43m        \u001b[49m\u001b[43mtable_name\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtable_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    404\u001b[39m \u001b[43m        \u001b[49m\u001b[43mengine\u001b[49m\u001b[43m=\u001b[49m\u001b[43mengine\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    405\u001b[39m \u001b[43m        \u001b[49m\u001b[43mengine_options\u001b[49m\u001b[43m=\u001b[49m\u001b[43mengine_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    406\u001b[39m \u001b[43m        \u001b[49m\u001b[43mread_options\u001b[49m\u001b[43m=\u001b[49m\u001b[43mread_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    407\u001b[39m \u001b[43m        \u001b[49m\u001b[43mschema_overrides\u001b[49m\u001b[43m=\u001b[49m\u001b[43mschema_overrides\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    408\u001b[39m \u001b[43m        \u001b[49m\u001b[43minfer_schema_length\u001b[49m\u001b[43m=\u001b[49m\u001b[43minfer_schema_length\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    409\u001b[39m \u001b[43m        \u001b[49m\u001b[43minclude_file_paths\u001b[49m\u001b[43m=\u001b[49m\u001b[43minclude_file_paths\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    410\u001b[39m \u001b[43m        \u001b[49m\u001b[43mraise_if_empty\u001b[49m\u001b[43m=\u001b[49m\u001b[43mraise_if_empty\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    411\u001b[39m \u001b[43m        \u001b[49m\u001b[43mhas_header\u001b[49m\u001b[43m=\u001b[49m\u001b[43mhas_header\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    412\u001b[39m \u001b[43m        \u001b[49m\u001b[43mcolumns\u001b[49m\u001b[43m=\u001b[49m\u001b[43mcolumns\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    413\u001b[39m \u001b[43m        \u001b[49m\u001b[43mdrop_empty_rows\u001b[49m\u001b[43m=\u001b[49m\u001b[43mdrop_empty_rows\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    414\u001b[39m \u001b[43m        \u001b[49m\u001b[43mdrop_empty_cols\u001b[49m\u001b[43m=\u001b[49m\u001b[43mdrop_empty_cols\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    415\u001b[39m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m    416\u001b[39m     \u001b[38;5;28;01mfor\u001b[39;00m src \u001b[38;5;129;01min\u001b[39;00m sources\n\u001b[32m    417\u001b[39m ]\n\u001b[32m    418\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m _unpack_read_results(\n\u001b[32m    419\u001b[39m     frames=frames,\n\u001b[32m    420\u001b[39m     read_multiple_workbooks=read_multiple_workbooks,\n\u001b[32m    421\u001b[39m )\n",
      "\u001b[36mFile \u001b[39m\u001b[32mD:\\anana\\damangshe\\envs\\week07\\Lib\\site-packages\\polars\\io\\spreadsheet\\functions.py:671\u001b[39m, in \u001b[36m_read_spreadsheet\u001b[39m\u001b[34m(source, sheet_id, sheet_name, table_name, engine, engine_options, read_options, schema_overrides, infer_schema_length, include_file_paths, columns, has_header, raise_if_empty, drop_empty_rows, drop_empty_cols)\u001b[39m\n\u001b[32m    668\u001b[39m schema_overrides = \u001b[38;5;28mdict\u001b[39m(schema_overrides \u001b[38;5;129;01mor\u001b[39;00m {})\n\u001b[32m    670\u001b[39m \u001b[38;5;66;03m# establish the reading function, parser, and available worksheets\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m671\u001b[39m reader_fn, parser, worksheets = \u001b[43m_initialise_spreadsheet_parser\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m    672\u001b[39m \u001b[43m    \u001b[49m\u001b[43mengine\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msource\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mengine_options\u001b[49m\n\u001b[32m    673\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m    674\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m    675\u001b[39m     \u001b[38;5;66;03m# parse data from the indicated sheet(s)\u001b[39;00m\n\u001b[32m    676\u001b[39m     sheet_names, return_multiple_sheets = _get_sheet_names(\n\u001b[32m    677\u001b[39m         sheet_id, sheet_name, table_name, worksheets\n\u001b[32m    678\u001b[39m     )\n",
      "\u001b[36mFile \u001b[39m\u001b[32mD:\\anana\\damangshe\\envs\\week07\\Lib\\site-packages\\polars\\io\\spreadsheet\\functions.py:855\u001b[39m, in \u001b[36m_initialise_spreadsheet_parser\u001b[39m\u001b[34m(engine, source, engine_options)\u001b[39m\n\u001b[32m    852\u001b[39m     \u001b[38;5;28;01mreturn\u001b[39;00m _read_spreadsheet_openpyxl, parser, sheets\n\u001b[32m    854\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m engine == \u001b[33m\"\u001b[39m\u001b[33mcalamine\u001b[39m\u001b[33m\"\u001b[39m:\n\u001b[32m--> \u001b[39m\u001b[32m855\u001b[39m     fastexcel = \u001b[43mimport_optional\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mfastexcel\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmin_version\u001b[49m\u001b[43m=\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43m0.7.0\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[32m    856\u001b[39m     reading_bytesio, reading_bytes = (\n\u001b[32m    857\u001b[39m         \u001b[38;5;28misinstance\u001b[39m(source, BytesIO),\n\u001b[32m    858\u001b[39m         \u001b[38;5;28misinstance\u001b[39m(source, \u001b[38;5;28mbytes\u001b[39m),\n\u001b[32m    859\u001b[39m     )\n\u001b[32m    860\u001b[39m     \u001b[38;5;28;01mif\u001b[39;00m (reading_bytesio \u001b[38;5;129;01mor\u001b[39;00m reading_bytes) \u001b[38;5;129;01mand\u001b[39;00m parse_version(\n\u001b[32m    861\u001b[39m         module_version := fastexcel.__version__\n\u001b[32m    862\u001b[39m     ) < (\u001b[32m0\u001b[39m, \u001b[32m10\u001b[39m):\n",
      "\u001b[36mFile \u001b[39m\u001b[32mD:\\anana\\damangshe\\envs\\week07\\Lib\\site-packages\\polars\\dependencies.py:274\u001b[39m, in \u001b[36mimport_optional\u001b[39m\u001b[34m(module_name, err_prefix, err_suffix, min_version, min_err_prefix, install_message)\u001b[39m\n\u001b[32m    269\u001b[39m     suffix = \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33m \u001b[39m\u001b[38;5;132;01m{\u001b[39;00merr_suffix.strip(\u001b[33m'\u001b[39m\u001b[33m \u001b[39m\u001b[33m'\u001b[39m)\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m err_suffix \u001b[38;5;28;01melse\u001b[39;00m \u001b[33m\"\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m    270\u001b[39m     err_message = \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mprefix\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmodule_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00msuffix\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m.\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[33m\"\u001b[39m + (\n\u001b[32m    271\u001b[39m         install_message\n\u001b[32m    272\u001b[39m         \u001b[38;5;129;01mor\u001b[39;00m \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mPlease install using the command `pip install \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmodule_root\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m`.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m    273\u001b[39m     )\n\u001b[32m--> \u001b[39m\u001b[32m274\u001b[39m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mModuleNotFoundError\u001b[39;00m(err_message) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m    276\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m min_version:\n\u001b[32m    277\u001b[39m     min_version = parse_version(min_version)\n",
      "\u001b[31mModuleNotFoundError\u001b[39m: required package 'fastexcel' not found.\nPlease install using the command `pip install fastexcel`."
     ]
    }
   ],
   "source": [
    "df = pl.read_excel(\"stock_trades/202305-海通普通.xlsx\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "8e57f9e6-9c2d-4ec4-9efc-5b7c72a6d0d1",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'list' object has no attribute 'write_parquet'",
     "output_type": "error",
     "traceback": [
      "\u001b[31m---------------------------------------------------------------------------\u001b[39m",
      "\u001b[31mAttributeError\u001b[39m                            Traceback (most recent call last)",
      "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[96]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[43mdf\u001b[49m\u001b[43m.\u001b[49m\u001b[43mwrite_parquet\u001b[49m(\u001b[33m\"\u001b[39m\u001b[33m1\u001b[39m\u001b[33m\"\u001b[39m)\n",
      "\u001b[31mAttributeError\u001b[39m: 'list' object has no attribute 'write_parquet'"
     ]
    }
   ],
   "source": [
    "df.write_parquet(\"1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "846b0c1c-e7f1-4a12-85a4-8ec8b3a0c265",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "456a6e03-281b-41c7-948e-dd2de9a77666",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
